package com.h9.framework;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by jaren.han on 2020-01-15.
 */
public class LogtailClient {

    static Logger logger = LoggerFactory.getLogger(LogtailClient.class);
    //static Logger logger = LoggerFactory.getLogger("receiveLog");

    public static void main(String[] args) {
        final FileWatch fileWatch = new FileWatch("/opt/logs/logtail/");
     // final FileWatch fileWatch = new FileWatch("D:\\opt\\logs\\quechub-lwm2m");
        try {
            fileWatch.start();
            logger.info("start");
        } catch (Exception ex) {
            logger.error("start error", ex);
        }
        Runtime.getRuntime().addShutdownHook(new Thread() {
            @Override
            public void run() {
                fileWatch.stop(); // send de-registration request before destroy
            }
        });
    }
}
